package com.glory.dmegcpda.model

import com.glory.dmegcpda.base.Constant
import com.glory.dmegcpda.bean.CheckListEntity
import com.glory.dmegcpda.bean.EqpTypeEntity
import com.glory.dmegcpda.bean.KeepInfoEntity
import com.google.gson.JsonObject
import rxhttp.wrapper.param.RxHttp
import rxhttp.wrapper.param.toResponse


/**
 * FileName: LoginRepository
 * Author: XJH
 * Date: 2021/5/24 17:11
 * Description:
 * History:
 */
class KeepRepository : BaseRepository() {

    suspend fun getEqpType(map: JsonObject): EqpTypeEntity {
        return RxHttp.postForm(Constant.mainUrl)
            .addAll(getInJsonDataForPms(map,"SYS.ADUREFLISTHANDLER"))
            .toResponse<EqpTypeEntity>()
            .await()
    }

    suspend fun getKeepList(map: JsonObject): CheckListEntity {
        return RxHttp.postForm(Constant.mainUrl)
            .addAll(getInJsonDataForPms(map,"SYS.GETENTITYLIST"))
            .toResponse<CheckListEntity>()
            .await()
    }

    suspend fun startKeep(map: JsonObject): Any {
        return RxHttp.postForm(Constant.mainUrl)
            .addAll(getInJsonDataForPms(map,"PMS.PMSSCHEDULEMANAGE"))
            .toResponse<Any>()
            .await()
    }

    suspend fun getKeepInfo(map: JsonObject): KeepInfoEntity {
        return RxHttp.postForm(Constant.mainUrl)
            .addAll(getInJsonDataForPms(map,"PMS.PMSSCHEDULEMANAGE"))
            .toResponse<KeepInfoEntity>()
            .await()
    }

    suspend fun saveKeepInfo(map: JsonObject): Any {
        return RxHttp.postForm(Constant.mainUrl)
            .addAll(getInJsonDataForPms(map,"PMS.PMSSCHEDULEMANAGE"))
            .toResponse<Any>()
            .await()
    }

}